package com.torches.cloud.mapper;

import com.torches.cloud.beans.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

/**
 * @author torches
 */
@Mapper
@Component
public interface UserMapper {

    /**
     *  根据用户名和密码查询用户
     * @param username
     * @param password
     * @return
     */
    @Select("select username, phoneNumber, profilePhoto from user where username = #{username} and password = #{password}")
    public User getUserByPassword(String username, String password);

    /**
     * 根据用户名，查询用户是否存在
     * @param username
     * @return
     */
    @Select("select * from user where username = #{username}")
    public User getUserByUserName(String username);

    @Insert("insert into user(username, phoneNumber, password) values(#{username},#{phoneNumber},#{password})")
    public void addUser(String username, String phoneNumber, String password);


}
